const express = require('express')
const router = express.Router()
const userHandler = require('../router_handler/user')
const handleValidationErrors = require('../middleware/handleValidationErrors')
const { strictApiLimiter } = require('../middleware/security')

const { registerSchema, loginSchema } = require('../schema/user')

// 为注册和登录路由添加严格的API限制
router.post('/reguser', strictApiLimiter, registerSchema, handleValidationErrors, userHandler.regUser)

router.post('/login', strictApiLimiter, loginSchema, handleValidationErrors, userHandler.login)

module.exports = router